<script setup lang="ts">
import { ref } from "vue";
import ColorManager from "../manager/colorManager";
const colorArr = ColorManager.get(0);
const props = defineProps({
    lable: String,
    width: Number,
});
const width = ref(typeof props.width == 'undefined' ? 120 : props.width);

const colorBor = ref(colorArr.border);
const colorBoxS = ref(colorArr.boxShadow);
const colorBack = ref(colorArr.background);
const colorText = ref(colorArr.text);


</script>

<template>
    <div class="button-piano-root" :lable="lable" :style="`width:${width}px`"></div>
</template>

<style scoped lang="scss">
.button-piano-root {
    width: 120px;
    height: 60px;
    padding: 0px 14px 4px 10px;
    color: v-bind(colorText);
}

.button-piano-root::before {
    content: '';
    display: inline-block;
    width: 100%;
    height: 35%;
    background-color: v-bind(colorBoxS);
    border: 2px solid v-bind(colorBor);
    transition-duration: 0.2s;
    border-radius: 5px;
    transform: translateZ(-1px);
    position: relative;
    left: 0px;
    top: 50%;
    box-shadow: 2px 3px 5px 4px v-bind(colorBack);
}

.button-piano-root::after {
    content: attr(lable);
    display: inline-block;
    text-align: center;
    line-height: 180%;
    width: 100%;
    height: calc(100% - 35% - 10px);
    background-color: white;
    border-radius: 5px;
    border: 2px solid rgb(128, 128, 128);
    transition-duration: 0.2s;
    position: relative;
    left: 0px;
    top: -30%;
    cursor: pointer;
    box-shadow: 0px 4px 5px 5px v-bind(colorBack);
}

.button-piano-root:hover::after {
    top: -35%;
}

.button-piano-root:active::after {
    top: -15%;
    box-shadow: 2px 3px 5px 4px rgb(0, 0, 0, 0);
}

.button-piano-root:active::before {
    box-shadow: 2px 3px 5px 4px rgb(0, 0, 0, 0);
}
</style>